package com.yungu.swift.admin.route.system;

import com.alibaba.dubbo.config.annotation.Reference;
import com.yungu.swift.base.ResponseData;
import com.yungu.swift.base.model.PageVo;
import com.yungu.swift.system.sys.model.dto.SysUserOperateLogDto;
import com.yungu.swift.system.sys.model.param.AdminBusinessOperateLogParam;
import com.yungu.swift.system.sys.model.param.AdminOperationLogPageParam;
import com.yungu.swift.system.sys.model.vo.SysBusinessOperateLogVo;
import com.yungu.swift.system.sys.model.vo.SysOperationCodeVo;
import com.yungu.swift.system.sys.service.SysBusinessOperateLogService;
import com.yungu.swift.system.sys.service.SysUserOperateLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author : cuixiuyin
 * @date : 2019/6/15
 */
@RestController
@RequestMapping("/admin/v1/system/operation/log")
@Api(value = "【系统服务】", tags = "日志监控")
public class OperationLogAdmin {

    @Reference
    private SysUserOperateLogService sysUserOperateLogService;
    @Reference
    private SysBusinessOperateLogService sysBusinessOperateLogService;


    @RequestMapping(value = "/queryPage", method = RequestMethod.POST)
    @ApiOperation(value = "系统操作日志分页", httpMethod = "POST")
    public ResponseData<PageVo<SysUserOperateLogDto>> queryPage(@RequestBody AdminOperationLogPageParam operationLogPageParam) {
        return sysUserOperateLogService.queryPage(operationLogPageParam);
    }

    @RequestMapping(value = "/queryBusinessLog", method = RequestMethod.POST)
    @ApiOperation(value = "系统业务操作日志分页", httpMethod = "POST")
    public ResponseData<PageVo<SysBusinessOperateLogVo>> businessLogQueryPage(@RequestBody AdminBusinessOperateLogParam param) {
        return sysBusinessOperateLogService.queryPage(param);
    }

    @RequestMapping(value = "/getOperationCode", method = RequestMethod.POST)
    @ApiOperation(value = "查询操作编码", httpMethod = "POST")
    public ResponseData<List<SysOperationCodeVo>> businessLogQueryPage() {
        return sysBusinessOperateLogService.getOperationCode();
    }
}
